package books.ThinkingInJava.src.Chapter11;


import books.ThinkingInJava.src.Tools.Output;

import java.util.Iterator;
import java.util.PriorityQueue;

public class Q24 {
    public static void main(String[] args) {
//        Queue<Command> que = new LinkedList<>();
        PriorityQueue<Command> que = new PriorityQueue<>();
        Comparable<Command> coms = new Comparable<Command>() {
            @Override
            public int compareTo(Command o) {
                return 0;
            }
        };

        for (int i = 0; i < 10; i++) {
            que.offer(new Command(i + ""));
        }
        Output.println("Queue.sise = " + que.size());


        Iterator<Command> ite = que.iterator();
        Command com;
        while (ite.hasNext()) {
            com = ite.next();
            ite.remove();
            com.operation();
        }
        Output.println("Queue.sise = " + que.size());
    }
}
